package com.party.tool;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class TimeUtils {
	private static SimpleDateFormat simpleFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm");
	
	public static int getDifftimeHours(Date startTime,Date endTime){
		int hours = 0 ;
		try {
		String fromDate = simpleFormat.format(startTime);  
		String toDate = simpleFormat.format(endTime);  
		long from = simpleFormat.parse(fromDate).getTime();  
		long to = simpleFormat.parse(toDate).getTime();
		hours = (int) ((to - from)/(1000 * 60 * 60)); 
		} catch (ParseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}  
		return hours;
	}
}
